<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserAddressTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_address', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('uid')->index()->comment('用户id');
            $table->string('name')->nullable()->comment('姓名');
            $table->string('phone')->nullable()->index()->comment('手机号');
            $table->unsignedInteger('province_id')->nullable()->comment('省id');
            $table->string('province')->nullable()->comment('省');
            $table->unsignedInteger('city_id')->nullable()->comment('市id');
            $table->string('city')->nullable()->comment('市');
            $table->unsignedInteger('county_id')->nullable()->comment('区县id');
            $table->string('county')->nullable()->comment('区县');
            $table->string('address')->comment('详细地址');
            $table->unsignedTinyInteger('type')->default(0)->comment('类型 0:无常用地址  1:家地址  2:公司地址 ');
            $table->string('tag')->comment('标签');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_address');
    }
}
